package cn.labbook.bluetooth.filter;

import cn.labbook.bluetooth.custom.FilterRequest;
import lombok.extern.log4j.Log4j2;

import javax.servlet.*;
import javax.servlet.http.HttpServletRequest;
import java.io.IOException;

@Log4j2
public class IntoFilter implements Filter {

    @Override
    public void init(FilterConfig filterConfig) throws ServletException {
        log.info("非法字符过滤器初始化成功");
    }

    @Override
    public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {
        HttpServletRequest request = (HttpServletRequest) servletRequest;
        FilterRequest wrapRequest = new FilterRequest(request);
        filterChain.doFilter(wrapRequest, servletResponse);
    }

    @Override
    public void destroy() {
        log.info("非法字符过滤器销毁");
    }


}
